void a(vector<TH1 *> &v, TObject *h){ v.push_back((TH1 *)h); }
void nh(){
  TFile *f = new TFile(getenv("TMP1"), "UPDATE");
  TTree *etf = (TTree *)f->Get("etf");
  vector<TH1 *> v;

  // --------------------- 6. Number of Hits Per Track ----------------------- //
  etf->Draw("preTaTrackerX.GetNofHits()>>h1(6, -0.5, 5.5)"); a(v,f->Get("h1"));
  etf->Draw("preTaTrackerY.GetNofHits()>>h2(6, -0.5, 5.5)"); a(v,f->Get("h2"));
  etf->Draw("postTaTrackerX.GetNofHits()>>h3(6, -0.5, 5.5)"); a(v,f->Get("h3"));
  etf->Draw("postTaTrackerY.GetNofHits()>>h4(6, -0.5, 5.5)"); a(v,f->Get("h4"));
  etf->Draw("postTaTracker3D.GetNofHits()>>h5(6, -0.5, 5.5)"); a(v,f->Get("h5"));
  etf->Draw("postMagTrackerX.GetNofHits()>>h6(8, -0.5, 7.5)"); a(v,f->Get("h6"));

  TCanvas *c1 = new TCanvas("c", "NofHits Per Trk - DCTa", 1680, 1050);
  c1->Divide(3, 2); const int nv = (int)v.size();
  for(int i = 0; i < nv; i++){
    c1->cd(i+1);
    if(v[i]) v[i]->Draw();
  } // end for
  c1->Print("nh.pdf");
} // end nh
